home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / perl5 / Getopt::Std.z / Getopt::Std
Encoding:
Text File  |  2002-10-03  |  2.0 KB  |  67 lines

  1.  
  2.  
  3.  
  4. GGGGeeeettttoooopppptttt::::::::SSSSttttdddd((((3333))))                                                  GGGGeeeettttoooopppptttt::::::::SSSSttttdddd((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      getopt - Process single-character switches with switch clustering
  10.  
  11.      getopts - Process single-character switches with switch clustering
  12.  
  13. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.          use Getopt::Std;
  15.  
  16.          getopt('oDI');    # -o, -D & -I take arg.  Sets opt_* as a side effect.
  17.          getopt('oDI', \%opts);    # -o, -D & -I take arg.  Values in %opts
  18.          getopts('oif:');  # -o & -i are boolean flags, -f takes an argument
  19.                            # Sets opt_* as a side effect.
  20.          getopts('oif:', \%opts);  # options as above. Values in %opts
  21.  
  22.  
  23. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  24.      The _g_e_t_o_p_t() functions processes single-character switches with switch
  25.      clustering.  Pass one argument which is a string containing all switches
  26.      that take an argument.  For each switch found, sets $opt_x (where x is
  27.      the switch name) to the value of the argument, or 1 if no argument.
  28.      Switches which take an argument don't care whether there is a space
  29.      between the switch and the argument.
  30.  
  31.      Note that, if your code is running under the recommended use strict
  32.      'vars' pragma, it may be helpful to declare these package variables via
  33.      use vars perhaps something like this:
  34.  
  35.          use vars qw/ $opt_foo $opt_bar /;
  36.  
  37.      For those of you who don't like additional variables being created,
  38.      _g_e_t_o_p_t() and _g_e_t_o_p_t_s() will also accept a hash reference as an optional
  39.      second argument. Hash keys will be x (where x is the switch name) with
  40.      key values the value of the argument or 1 if no argument is specified.
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.